﻿/*
 * User: David
 * Date: 29/06/2013
 * Time: 1:19 AM
 * 
 */
using System;
using System.Collections.Generic;
using HockeySimulator.Interfaces;

namespace HockeySimulator.Entities.League
{
	/// <summary>
	/// Description of Team.
	/// </summary>
	public class Team:iExportable
	{
		private string Name;
		
		private long SalarialMass;
		
		private GeneralManager GM;
		private Coach HeadCoach;
		private List<Coach> AssistantCoach;
		private List<ForwardLine> ForwardLines;
		private List<DefenseLine> DefenseLines;
		private GoaltendersDuo Goaltenders;
		
		private Player ExtraPlayer;
				
		public Team()
		{
			defaultTeamInitialize();
		}
		
		public Team(GeneralManager GManager, Coach HC, List<Coach> Assistants, List<ForwardLine> FWLines, List<DefenseLine> DLines, Goaltender MainGoaltender, Goaltender BackupGoaltender, Player Extra, string TeamName = "")
		{
			Name = (TeamName!= null?TeamName:"");
			
			GM = new GeneralManager(GManager);
			HeadCoach = new Coach(HC);
			AssistantCoach = new List<Coach>(Assistants);
			ForwardLines = new List<ForwardLine>(FWLines);
			DefenseLines = new List<DefenseLine>(DLines);
			Goaltenders = new GoaltendersDuo(MainGoaltender, BackupGoaltender);
			
			ExtraPlayer = new Player(Extra);
		}
		
		
		private void defaultTeamInitialize()
		{
			Name = "DefaultTeamName";
			
			GM = new GeneralManager();
			HeadCoach = new Coach();
			
			AssistantCoach = new List<Coach>(2);
			AssistantCoach.Add(new Coach());
			AssistantCoach.Add(new Coach());
			
			ForwardLines = new List<ForwardLine>(4);
			for(int i = 0; i < 4; i++)
				ForwardLines.Add(new ForwardLine());
			
			DefenseLines = new List<DefenseLine>(3);
			for(int i = 0; i < 3; i++)
				DefenseLines.Add(new DefenseLine());
			
			Goaltenders = new GoaltendersDuo();
			
			ExtraPlayer = new Player();
		}
		
		//Interface method
		
		public string Export()
		{
			string NL = Environment.NewLine;
			
			string result = "Team : " + Name + NL;
			result += "%%%%%%%%%%%%%%%%%%%%%%%%%" + NL;
			
			result += "TODO";
			
			result += "%%%%%%%%%%%%%%%%%%%%%%%%%" + NL;
			
			return result;
		}
		
		//Other methods
	}

}
